﻿<UserControl x:Class="GIMS.GUI.ArgumentControls.GeometryArgumentControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <BooleanToVisibilityConverter x:Key="boolToVisibilityConverter" />
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <!--Choose Geometry Type-->
        <StackPanel Orientation="Horizontal"
            Visibility="{Binding Path=HasMoreThenOneGeometryType, Converter={StaticResource boolToVisibilityConverter}}">
            <TextBlock>Geometry Type</TextBlock>

            <ComboBox ItemsSource="{Binding Path=GeometryTypeRepresenters}"
                      DisplayMemberPath="Name"
                      SelectedValuePath="Value"
                      SelectedValue="{Binding Path=GeometryArgument.SelectedGeometryType}" Margin="3"></ComboBox>
        </StackPanel>

        <!--Percent-->
        <Grid Grid.Row="1"
              MinWidth="150"
              Visibility="{Binding Path=IsPercent, Converter={StaticResource boolToVisibilityConverter}}">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Row="0" Grid.Column="0" Margin="3">Percent of original:</TextBlock>
            <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Path=GeometryArgument.Scale, ValidatesOnExceptions=True}" Margin="3" />
        </Grid>

        <!--xyPercent-->
        <Grid Grid.Row="2"
              MinWidth="150"
              Visibility="{Binding Path=IsxyPercent, Converter={StaticResource boolToVisibilityConverter}}">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Row="0" Grid.Column="0" Margin="3">Percent of original width:</TextBlock>
            <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Path=GeometryArgument.ScaleX, ValidatesOnExceptions=True}" Margin="3" />
            <TextBlock Grid.Row="1" Grid.Column="0" Margin="3">Percent of original height:</TextBlock>
            <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Path=GeometryArgument.ScaleY, ValidatesOnExceptions=True}" Margin="3" />
        </Grid>

        <!--Width & WidthxHeight-->
        <Grid Grid.Row="3"
              MinWidth="150"
              Visibility="{Binding Path=IsWidth, Converter={StaticResource boolToVisibilityConverter}}">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Column="0" Margin="3">New Width:</TextBlock>
            <TextBox Grid.Column="1" Text="{Binding Path=GeometryArgument.Width, ValidatesOnExceptions=True}" Margin="3" />
            <TextBlock Grid.Column="2" Margin="3">Pixel</TextBlock>
        </Grid>

        <!--Height & WidthxHeight-->
        <Grid Grid.Row="4"
              MinWidth="150"
              Visibility="{Binding Path=IsHeigth, Converter={StaticResource boolToVisibilityConverter}}">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Column="0" Margin="3">New Height:</TextBlock>
            <TextBox Grid.Column="1" Text="{Binding Path=GeometryArgument.Height, ValidatesOnExceptions=True}" Margin="3" />
            <TextBlock Grid.Column="2" Margin="3">Pixel</TextBlock>
        </Grid>

        <!--Area-->
        <Grid Grid.Row="5"
              MinWidth="150"
              Visibility="{Binding Path=IsArea, Converter={StaticResource boolToVisibilityConverter}}">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Column="0" Margin="3">New Area:</TextBlock>
            <TextBox Grid.Column="1" Text="{Binding Path=GeometryArgument.Area, ValidatesOnExceptions=True}" Margin="3" />
            <TextBlock Grid.Column="2" Margin="3">Pixel</TextBlock>
        </Grid>

        <!--Offset-->
        <Grid Grid.Row="6"
              MinWidth="150"
              Visibility="{Binding Path=IsOffsetNeeded, Converter={StaticResource boolToVisibilityConverter}}">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Row="0" Grid.Column="0" Margin="3">X-Offset:</TextBlock>
            <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Path=GeometryArgument.XOffset, ValidatesOnExceptions=True}" Margin="3" />
            <TextBlock Grid.Row="0" Grid.Column="2">Pixel</TextBlock>
            <TextBlock Grid.Row="1" Grid.Column="0" Margin="3">Y-Offset:</TextBlock>
            <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Path=GeometryArgument.YOffset, ValidatesOnExceptions=True}" Margin="3" />
            <TextBlock Grid.Row="0" Grid.Column="2">Pixel</TextBlock>
        </Grid>
    </Grid>
</UserControl>
